from routes import db, login_manager
from sqlalchemy import Integer, String, BLOB, TIMESTAMP, Column, DECIMAL, String
from sqlalchemy.orm import Mapped, mapped_column


class Vep(db.Model):
    __tablename__ = 'vep_data'

    id = db.Column(db.Integer, primary_key=True)
    region = db.Column(db.String(255), nullable=False)
    year = db.Column(db.Integer, nullable=False)
    region_area = db.Column(db.Float, nullable=False)
    region_regulation_service = db.Column(db.Float, nullable=False)
    region_water_purification_gep = db.Column(db.Float, nullable=False)
    avg_soil_carbon_storage = db.Column(db.Float, nullable=False)
    avg_vegetation_carbon_storage = db.Column(db.Float, nullable=False)

    __table_args__ = (
        db.UniqueConstraint('region', 'year', name='unique_region_year'),
    )


class VepTest(db.Model):
    __tablename__ = 'vep_test'

    id = db.Column(db.Integer, primary_key=True)
    vepName = db.Column(db.String(255), nullable=False, primary_key=True)
    vepTestValue = db.Column(db.Float)
    inAnnualProductValue = db.Column(db.Float)
    inAnnualTotalCost = db.Column(db.Float)
    inProcessProfit = db.Column(db.Float)
    inCleanEnergyGeneration = db.Column(db.Float)
    inElectricityPrice = db.Column(db.Float)
    inTourismRevenue = db.Column(db.Float)
    inHotelRoomCount = db.Column(db.Float)
    inHotelPrice = db.Column(db.Float)
    inAnnualOccupancy = db.Column(db.Float)
    inPropertyProfit = db.Column(db.Float)
    inDailyTraffic = db.Column(db.Float)
    inTourismHealthProfit = db.Column(db.Float)
    inProjectLandArea = db.Column(db.Float)
    inSoilCarbonStorage = db.Column(db.Float)
    inVegetationCarbonStorage = db.Column(db.Float)
    inTotalNitrogen = db.Column(db.Float)
    inTotalPhosphorus = db.Column(db.Float)
    inAmmoniaNitrogen = db.Column(db.Float)
    inBod5 = db.Column(db.Float)
    inCodCr = db.Column(db.Float)

